package com.xcj.cloud.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
public class WelComeController {

    @RequestMapping("/")
    public String toLogin(){
        return "user/login";
    }

    @RequestMapping("/login")
    public String login(){
        return "user/login";
    }

    @RequestMapping("/admin")
    public String admin(){
        return "admin/login";
    }

    @RequestMapping("/admin/user/login")
    public String welcome(){
        return "user/login";
    }


    /**
     * 通用跳转方法
     * @param module
     * @return
     */
    @RequestMapping("/{module}_")
    public String welcome(@PathVariable("module") String module){
        return module;
    }

    @GetMapping("/{module}/{path}")
    public String welcome(@PathVariable("module") String module, @PathVariable("path")String path){
        return String.join("/",module,path);
    }

    @GetMapping("{a}/{b}/{c}_")
    public String welcome(@PathVariable("a") String a, @PathVariable("b") String b, @PathVariable("c") String c){
        return String.join("/",a,b,c);
    }
}
